package cn.ainit.base.modify;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.ainit.sys.menu.SessionCont;

@Service
public class ModifyService {
	private ModifyDao modifyDao;

    @Resource
	public void setModifyDao(ModifyDao modifyDao) {
		this.modifyDao = modifyDao;
	}

	public String getModifyInfo(ModifyParm mp) throws Exception {
        //查询出数据
		String id = mp.getSession().getAttribute(SessionCont.uid).toString();
		String sql ="select * from bs_operators where o_pass_word ='"+mp.getOdlpwd()+"' and O_ID='"+id+"'";
		List list=modifyDao.getUserInfo(sql);
		if(list.size()>0){
			String updateSql="update bs_operators set o_pass_word='"+mp.getPwd()+"' where O_ID ='"+id+"'";
			
			boolean  bs=modifyDao.getjdbcUpdateBysql(updateSql);
			
			
			if(bs==true){
				return "success";
			}else {
				return "error";
			}
			
		}
		return "pwderror";
	}

}
